package org.kabanyo.utils {

	public class IndonesiaProvinceUtil {
		public static const ACEH:IndonesiaProvinceUtil=new IndonesiaProvinceUtil("acehButton", "Aceh");
		public static const SUMUT:IndonesiaProvinceUtil=new IndonesiaProvinceUtil("sumutButton", "Sumatera Utara");
		public static const SUMBAR:IndonesiaProvinceUtil=new IndonesiaProvinceUtil("sumbarButton", "Sumatera Barat");
		public static const RIAU:IndonesiaProvinceUtil=new IndonesiaProvinceUtil("riauButton", "Riau");
		public static const KEPRI:IndonesiaProvinceUtil=new IndonesiaProvinceUtil("kepriButton", "Kepulauan Riau");
		public static const BENGKULU:IndonesiaProvinceUtil=new IndonesiaProvinceUtil("bengkuluButton", "Bengkulu");
		public static const JAMBI:IndonesiaProvinceUtil=new IndonesiaProvinceUtil("jambiButton", "Jambi");
		public static const SUMSEL:IndonesiaProvinceUtil=new IndonesiaProvinceUtil("sumselButton", "Sumatera Selatan");
		public static const BABEL:IndonesiaProvinceUtil=new IndonesiaProvinceUtil("babelButton", "Kepulauan Bangka Belitung");
		public static const LAMPUNG:IndonesiaProvinceUtil=new IndonesiaProvinceUtil("lampungButton", "Lampung");
		public static const BANTEN:IndonesiaProvinceUtil=new IndonesiaProvinceUtil("bantenButton", "Banten");
		public static const DKI:IndonesiaProvinceUtil=new IndonesiaProvinceUtil("dkiButton", "DKI Jakarta");
		public static const JABAR:IndonesiaProvinceUtil=new IndonesiaProvinceUtil("jabarButton", "Jawa Barat");
		public static const JATENG:IndonesiaProvinceUtil=new IndonesiaProvinceUtil("jatengButton", "Jawa Tengah");
		public static const DIY:IndonesiaProvinceUtil=new IndonesiaProvinceUtil("diyButton", "DI Yogyakarta");
		public static const JATIM:IndonesiaProvinceUtil=new IndonesiaProvinceUtil("jatimButton", "Jawa Timur");
		public static const BALI:IndonesiaProvinceUtil=new IndonesiaProvinceUtil("baliButton", "Bali");
		public static const NTB:IndonesiaProvinceUtil=new IndonesiaProvinceUtil("ntbButton", "Nusa Tenggara Barat");
		public static const NTT:IndonesiaProvinceUtil=new IndonesiaProvinceUtil("nttButton", "Nusa Tenggara Timur");
		public static const KALBAR:IndonesiaProvinceUtil=new IndonesiaProvinceUtil("kalbarButton", "Kalimantan Barat");
		public static const KALTENG:IndonesiaProvinceUtil=new IndonesiaProvinceUtil("kaltengButton", "Kalimantan Tengah");
		public static const KALTIM:IndonesiaProvinceUtil=new IndonesiaProvinceUtil("kaltimButton", "Kalimantan Timur");
		public static const KALSEL:IndonesiaProvinceUtil=new IndonesiaProvinceUtil("kalselButton", "Kalimanatan Selatan");
		public static const SULUT:IndonesiaProvinceUtil=new IndonesiaProvinceUtil("sulutButton", "Sulawesi Utara");
		public static const GORONTALO:IndonesiaProvinceUtil=new IndonesiaProvinceUtil("gorontaloButton", "Gorontalo");
		public static const SULTENG:IndonesiaProvinceUtil=new IndonesiaProvinceUtil("sultengButton", "Sulawesi Tengah");
		public static const SULBAR:IndonesiaProvinceUtil=new IndonesiaProvinceUtil("sulbarButton", "Sulawesi Barat");
		public static const SULTRA:IndonesiaProvinceUtil=new IndonesiaProvinceUtil("sultraButton", "Sulawesi Tenggara");
		public static const SULSEL:IndonesiaProvinceUtil=new IndonesiaProvinceUtil("sulselButton", "Sulawesi Selatan");
		public static const MALUT:IndonesiaProvinceUtil=new IndonesiaProvinceUtil("malutButton", "Maluku Utara");
		public static const MALUKU:IndonesiaProvinceUtil=new IndonesiaProvinceUtil("malukuButton", "Maluku");
		public static const PAPBAR:IndonesiaProvinceUtil=new IndonesiaProvinceUtil("papbarButton", "Papua Barat");
		public static const PAPUA:IndonesiaProvinceUtil=new IndonesiaProvinceUtil("papuaButton", "Papua");

		public var mapButtonName:String;
		public var mapButtonLabel:String;

		public function IndonesiaProvinceUtil(mapButtonName:String, mapButtonLabel:String) {
			this.mapButtonName=mapButtonName;
			this.mapButtonLabel=mapButtonLabel;
		}

		public static function getList():Array {
			var result:Array=sumateraList();
			result.concat(jawaList());
			result.concat(nusaTenggaraList());
			result.concat(kalimantanList());
			result.concat(sulawesiList());
			result.concat(malukuList());
			result.concat(papuaList());
			return result;
		}

		public static function sumateraList():Array {
			return [ACEH, SUMUT, SUMBAR, RIAU, KEPRI, BENGKULU, JAMBI, SUMSEL, BABEL, LAMPUNG];
		}

		public static function jawaList():Array {
			return [BANTEN, DKI, JABAR, JATENG, DIY, JATIM];
		}

		public static function nusaTenggaraList():Array {
			return [BALI, NTB, NTT];
		}

		public static function kalimantanList():Array {
			return [KALBAR, KALTENG, KALTIM, KALSEL];
		}

		public static function sulawesiList():Array {
			return [SULUT, GORONTALO, SULTENG, SULBAR, SULTRA, SULSEL];
		}

		public static function malukuList():Array {
			return [MALUT, MALUKU];
		}

		public static function papuaList():Array {
			return [PAPBAR, PAPUA];
		}

		public static function labelToName(label:String):String {
			var mapList:Array=getList();
			for (var i:int=0; i < mapList.length; i++) {
				if ((mapList[i] as IndonesiaProvinceUtil).mapButtonLabel == label) {
					return (mapList[i] as IndonesiaProvinceUtil).mapButtonName;
				}
			}
			return null;
		}

		public static function nameToLabel(name:String):String {
			var mapList:Array=getList();
			for (var i:int=0; i < mapList.length; i++) {
				if ((mapList[i] as IndonesiaProvinceUtil).mapButtonName == name) {
					return (mapList[i] as IndonesiaProvinceUtil).mapButtonLabel;
				}
			}
			return null;
		}

	}
}
